package com.example.springbootmybatisplus.controller;

import cn.hutool.core.date.StopWatch;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.example.springbootmybatisplus.bean.Emp;
import com.example.springbootmybatisplus.service.EmpService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

/**
 * @ClassName EasyExcelController
 * @Description: TODO
 * @Author: Sunny
 * @Create: 2024-09-11 20:53
 * @Version 1.0
 **/
@RestController
@RequestMapping("/api/easyExcel")
public class EasyExcelController {


    @Resource
    private  EmpService  empService;

    @GetMapping("/export")
    public  void  export()  throws  IOException  {
        StopWatch stopWatch  =  new  StopWatch();
        stopWatch.start();
        empService.export();
        stopWatch.stop();
        System.out.println("共计耗时：  "  +  stopWatch.getTotalTimeSeconds()+"S");
    }

    @GetMapping("/test")
    public  void  test()  throws  IOException  {

        Long count = Db.lambdaQuery(Emp.class).count();
        System.out.println("222");


    }
}